{include file="public/layout" /}

{eq name="$editor.editor_select" value="1"}
    {load href="__PUBLIC__/plugins/Ueditor/ueditor.config.js" /}
    {load href="__PUBLIC__/plugins/Ueditor/ueditor.all.min.js" /}
    {load href="__PUBLIC__/plugins/Ueditor/lang/zh-cn/zh-cn.js" /}
{else/}
    {load href="__PUBLIC__/plugins/ckeditor/ckeditor.js" /}
{/eq}

<body class="eyou_body_xin">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
{include file="system/left" /}
<div id="geduan_div" class="h15"></div>
<div class="page shop-page" style="min-width:auto;margin-left:115px;padding-bottom: 15px;">
    <div class="fixed-bar">
        <div class="item-title">
            <a class="back_xin" href="{:url('Help/index')}" title="返回"><i class="iconfont e-fanhui"></i></a>
            <div class="subject">
                <h3>发布文档</h3>
                <h5></h5>
            </div>
            <!-- <ul class="tab-base nc-row"> -->
                <!-- <li><a href="javascript:void(0);" data-index='1' class="tab current"><span>基础内容</span></a></li> -->
                <!-- <li><a href="javascript:void(0);" data-index='2' class="tab"><span>SEO优化</span></a></li> -->
                <!-- <li><a href="javascript:void(0);" data-index='3' class="tab"><span>更多设置</span></a></li> -->
                <!-- #weapp_demontrate_li# -->
            <!-- </ul> -->
        </div>
    </div>
    <form class="form-horizontal" id="post_form" action="{:url('Help/eyou_add_help')}" method="post">
        <!-- 常规信息 -->
        <div class="ncap-form-default tab_div_1">
            <dl class="row">
                <dt class="tit">
                    <label for="title"><em>*</em>文档标题</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="title" value="" id="title" class="input-txt" maxlength="200" {eq name="$channelRow.is_repeat_title" value="0"} oninput="check_title_repeat(this,0);" {/eq}>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <!-- 副标题：<input type="text" name="subtitle" value="" id="subtitle" class="w200"> -->
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="title"><em>*</em>帮助分类</label>
                </dt>
                <dd class="opt"> 
                    <select name="typeid" id="typeid">
                        <option value="0">请选择分类…</option>
                        {foreach name="$type_list" item="vo" key="k" }
                        <option value="{$vo.id}">{eq name='$vo.grade' value='2'}&nbsp;&nbsp;&nbsp;&nbsp;{/eq}{$vo.typename}</option>
                        {/foreach}
                    </select>
                    <span class="err"></span>
                </dd>
            </dl>
            <dl class="row none dl_jump">
                <dt class="tit">
                    <label>跳转网址</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="" name="jumplinks" id="jumplinks" class="input-txt" placeholder="http://">
                    <span class="err"></span>
                </dd>
            </dl>
            <!-- <dl class="row">
                <dt class="tit"> <label>封面图片</label> </dt>
                <dd class="opt">
                    <div class="tab-pane pics" id="tab_proimg">
                        <table class="table table-bordered">
                            <tbody>
                            <tr>
                                <td>
                                    <div class="sort-list">
                                        <div class="images_upload" id="litpic_div" style="width: 100px;">
                                            <div class="ic">
                                                <div class='upimg'>
                                                    <div class='icaction' style="display: none;">
                                                        <span class="load_images" id="litpic_bigImg"><a href="javascript:void(0);" style="color: white;"><i class='fa fa-search-plus'></i>大图</a></span>
                                                        <span class="load_images" id="litpic_update"><i class='fa fa-photo'></i>更换</span>
                                                    </div>
                                                    <div class='cover-bg' style="display: none;"></div>
                                                    <img id="litpic_img" src=""/>
                                                    <input type="hidden" name="litpic" id="litpic">
                                                    <a class="delect" id="litpic_delect" href="javascript:void(0);" title="删除"></a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <a href="javascript:void(0);" onclick="GetUploadify(1, '', 'allimg', 'litpic_call_back');" class="img-upload mb15" title="点击上传" id="litpic_a"> <div class="y-line"></div> <div class="x-line"></div> </a>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </dd>
            </dl> -->
            {include file="archives/get_field_addonextitem" /}
        </div>
        <!-- 常规信息 -->
        <!-- SEO参数 -->
        <div class="ncap-form-default tab_div_2" style="display:none;">
            <dl class="row">
                <dt class="tit">
                    <label for="seo_title">SEO标题</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="" name="seo_title" id="seo_title" class="input-txt">
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>SEO关键词</label>
                </dt>
                <dd class="opt">          
                    <textarea rows="5" cols="60" id="seo_keywords" name="seo_keywords" style="height:40px;"></textarea>
                    <span class="err"></span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>SEO描述</label>
                </dt>
                <dd class="opt">          
                    <textarea rows="5" cols="60" id="seo_description" name="seo_description" style="height:60px;"></textarea>
                    <span class="err"></span>
                </dd>
            </dl>
        </div>
        <!-- SEO参数 -->
        <!-- 其他参数 -->
        <div class="ncap-form-default tab_div_3" style="display:none;">
            <dl class="row">
                <dt class="tit">
                    <label for="author">作者</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$Think.session.admin_info.pen_name|default='小编'}" name="author" id="author" class="input-txt">
                </dd>
            </dl>
            <dl class="row dl_origin">
                <dt class="tit">
                    <label>来源</label>
                </dt>
                <dd class="opt origin-hot">
                    <input type="text" value="{$system_originlist_0}" name="origin" id="origin" class="input-txt" onclick="searchOrigin(this);" autocomplete="off">
                    <div class="origin-hot-list" style="display: none;" id="search_keywords_list_origin"></div>
                    <textarea id="system_originlist_str" style="display: none;">{$system_originlist_str}</textarea>
                    <span class="err"></span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>点击数</label>
                </dt>
                <dd class="opt">    
                    <input type="text" value="{$rand_arcclick}" name="click" id="click" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>阅读权限</label>
                </dt>
                <dd class="opt">
                    <select name="arcrank" id="arcrank" {if $admin_info.role_id > 0 && $auth_role_info.check_oneself < 1} disabled="disabled" {/if}>
                        {volist name="arcrank_list" id="vo"}
                        <option value="{$vo.rank}" {if $admin_info.role_id > 0 && $auth_role_info.check_oneself < 1 && $vo.rank==-1} selected="selected" {/if}>{$vo.name}</option>
                        {/volist}
                    </select>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <!-- #weapp_UsersGroup_content_users_id={$field.users_id}#--><!-- #weapp_UsersGroup_content# -->
            <dl class="row">
                <dt class="tit">
                    <label for="articleForm">发布时间</label>
                </dt>
                <dd class="opt">
                    <input type="text" class="input-txt" id="add_time" name="add_time" value="{php}echo date('Y-m-d H:i:s'){/php}" autocomplete="off">        
                    <span class="add-on input-group-addon">
                        <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
                    </span> 
                    <span class="err"></span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="tempview">文档模板</label>
                </dt>
                <dd class="opt">
                    <select name="tempview" id="tempview">
                        {volist name='$templateList' id='vo'}
                        <option value="{$vo}" {eq name='$vo' value='$tempview'}selected{/eq}>{$vo}</option>
                        {/volist}
                    </select>
                    <input type="hidden" name="type_tempview" value="{$tempview}" />
                    <span class="err"></span>
                </dd>
            </dl>
            <dl class="row {notin name='$seo_pseudo' value='2'}no-grey{/notin}" >
                <dt class="tit">
                    <label>自定义文件名</label>
                </dt>
                <dd class="opt">
                    <input type="text" {notin name='$seo_pseudo' value='2'}readonly="readonly" title="仅在静态模式下使用"{/notin} value="" name="htmlfilename" id="htmlfilename" autocomplete="off" onkeyup="this.value=this.value.replace(/[^\w\-]/g,'-');" onpaste="this.value=this.value.replace(/[^\w\-]/g,'-');" class="input-txt {notin name='$seo_pseudo' value='2'}no-drop{/notin}">.html
                    <span class="err"></span>
                </dd>
            </dl>
        </div>
        <!-- 其他参数 -->
        <div class="bot2" style="left: 115px;">
            <input type="hidden" name="gourl" value="{$gourl|default=''}">
            <input type="hidden" id="editor_addonFieldExt" value="">
            <a href="JavaScript:void(0);" onclick="check_submit();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
            <a class="ncap-btn-big ncap-btn-no" href="javascript:history.back();" title="返回">返回</a>
        </div>
    </form>
</div>
<script type="text/javascript">
    layui.use('laydate', function() {
        var laydate = layui.laydate;
        var myDate = new Date;
        var year = myDate.getFullYear(); //获取当前年
        var mon = myDate.getMonth() + 1; //获取当前月
        var day = myDate.getDate(); //获取当前日
        var mark_time = year + "-" + mon + "-" + day;//当前日期
        var mark = [];
        mark[mark_time] = '';

        laydate.render({
            elem: '#add_time'
            ,type: 'datetime'
            ,mark: mark
            ,ready: function(date) {
                if (!$('#add_time').val() || mark_time != $('#add_time').val()) {
                    $('.laydate-day-mark').removeClass('laydate-day-mark').parent().addClass('today_laydate_mark');
                    $('.today_laydate_mark').removeClass('layui-this');
                }
            }
            ,change: function(value, date, endDate) {
                $('.laydate-day-mark').addClass('today_laydate_mark').removeClass('laydate-day-mark');
            }
        });
    })

    $(function () {
        //选项卡切换列表
        $('.tab-base').find('.tab').click(function(){
            $('.tab-base').find('.tab').each(function(){
                $(this).removeClass('current');
            });
            $(this).addClass('current');
            var tab_index = $(this).data('index');          
            $(".tab_div_1, .tab_div_2, .tab_div_3").hide();          
            $(".tab_div_"+tab_index).show();
            layer.closeAll();
        });

        $('input[name=is_jump]').click(function(){
            if ($(this).is(':checked')) {
                $('.dl_jump').show();
            } else {
                $('.dl_jump').hide();
            }
        });

        $('#typeid').change(function(){
            GetAddonextitem(1, $(this).val(), 1, 0, true);
        });
    });

    // 判断输入框是否为空
    function check_submit(){
        if($.trim($('input[name=title]').val()) == ''){
            showErrorMsg('标题不能为空！');
            $($('.tab-base').find('.tab')[0]).trigger('click'); 
            $('input[name=title]').focus();
            return false;
        }
        if ($('#typeid').val() == 0) {
            showErrorMsg('请选择栏目！');
            $('#typeid').focus();
            return false;
        }

        layer_loading('正在处理');
        if(!ajax_check_htmlfilename())
        {
            layer.closeAll();
            showErrorMsg('自定义文件名已存在！');
            $('input[name=htmlfilename]').focus();
            return false;
        }

        setTimeout(function (){
            editor_auto_210607();
            $('#post_form').submit();
        }, 1);
    }

    // 鼠标事件，加载查看大图和更新图片
    $(document).ready(function() {
        $(".upimg").live('mouseover', function() {
            $(this).find('div.icaction').show();
            $(this).find('div.cover-bg').show();
        }).live('mouseout', function() {
            $(this).find('div.icaction').hide();
            $(this).find('div.cover-bg').hide();
        });
    });

    // 商品主图回调加载
    function litpic_call_back(paths) {
        $('#litpic_a').hide();
        $('#litpic_div').show();
        $('#litpic_div #litpic').val(paths);
        $('#litpic_div #litpic_img').attr('src', paths);
        $('#litpic_div #litpic_delect').attr('onclick', "litpicClear();");
        $('#litpic_div #litpic_bigImg').attr('onclick', "Images('"+paths+"', 900, 600);");
        $('#litpic_div #litpic_update').attr('onclick', "GetUploadify(1, '', 'allimg', 'litpic_call_back');");
    }

    // 商品主图清除
    function litpicClear() {
        $('#litpic_a').show();
        $('#litpic_div').hide();
        $('#litpic_div #litpic').val('');
        $('#litpic_div #litpic_img').attr('src', '');
        $('#litpic_div #litpic_delect').attr('onclick', '');
        $('#litpic_div #litpic_bigImg').attr('onclick', '');
        $('#litpic_div #litpic_update').attr('onclick', '');
    }

</script>

{include file="public/footer" /}
<script>
    try{
        var mt20_1649209614 = sessionStorage.getItem("mt20_1649209614");
        if (mt20_1649209614 == 1){
            $("#geduan_div").removeClass("h15");
        }else{
            $("#geduan_div").addClass("h15");
        }
    }catch(e){}
</script>